{{!
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
}}

{{#if loaded}}
  <table class='detail-list'>
    <thead>
      <tr>
        <th colspan=2>Details</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Vertex ID</td>
        <td>{{model.entityID}}</td>
      </tr>
      <tr>
        <td>Vertex Name</td>
        <td>{{model.name}}</td>
      </tr>
      <tr>
        <td>Processor Class</td>
        <td>{{model.processorClassName}}</td>
      </tr>
      <tr>
        <td>Status</td>
        <td>{{em-table-status-cell content=model.finalStatus}}</td>
      </tr>
      <tr>
        <td>Progress</td>
        <td>{{em-table-progress-cell content=model.progress}}</td>
      </tr>
      <tr>
        <td>Start Time</td>
        <td>{{date-formatter content=model.startTime}}</td>
      </tr>
      <tr>
        <td>End Time</td>
        <td>{{date-formatter content=model.endTime}}</td>
      </tr>
      <tr>
        <td>Duration</td>
        <td>{{txt model.duration type="duration"}}</td>
      </tr>
    </tbody>
  </table>

  <table class='detail-list'>
    <thead>
      <tr>
        <th colspan=2>Stats</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>Total Tasks</td>
        <td>{{stats-link value=model.totalTasks routeName="vertex.tasks"}}</td>
      </tr>
      <tr>
        <td>Succeeded Tasks</td>
        <td>{{stats-link value=model.succeededTasks routeName="vertex.tasks" statsType="SUCCEEDED"}}</td>
      </tr>
      <tr>
        <td>Failed Tasks</td>
        <td>{{stats-link value=model.failedTasks routeName="vertex.tasks" statsType="FAILED"}}</td>
      </tr>
      <tr>
        <td>Killed Tasks</td>
        <td>{{stats-link value=model.killedTasks routeName="vertex.tasks" statsType="KILLED"}}</td>
      </tr>
      <tr>
        <td>Failed Task Attempts</td>
        <td>{{stats-link value=model.failedTaskAttempts routeName="vertex.attempts" statsType="FAILED"}}</td>
      </tr>
      <tr>
        <td>Killed Task Attempts</td>
        <td>{{stats-link value=model.killedTaskAttempts routeName="vertex.attempts" statsType="KILLED"}}</td>
      </tr>
      <tr>
        <td>First Task Start Time</td>
        <td>
          {{date-formatter content=model.firstTaskStartTime}}
          {{#if firstTasksToStart}}
            [{{em-table-linked-cell content=firstTasksToStart}}]
          {{/if}}
        </td>
      </tr>
      <tr>
        <td>Last Task Finish Time</td>
        <td>
          {{date-formatter content=model.lastTaskFinishTime}}
          {{#if lastTasksToFinish}}
            [{{em-table-linked-cell content=lastTasksToFinish}}]
          {{/if}}
        </td>
      </tr>
      <tr>
        <td>Average Duration</td>
        <td>
          {{txt model.avgDuration type="duration"}}
        </td>
      </tr>
      <tr>
        <td>Minimum Duration</td>
        <td>
          {{txt model.minDuration type="duration"}}
          {{#if shortestDurationTasks}}
            [{{em-table-linked-cell content=shortestDurationTasks}}]
          {{/if}}
        </td>
      </tr>
      <tr>
        <td>Maximum Duration</td>
        <td>
          {{txt model.maxDuration type="duration"}}
          {{#if longestDurationTasks}}
            [{{em-table-linked-cell content=longestDurationTasks}}]
          {{/if}}
        </td>
      </tr>
    </tbody>
  </table>

  <!-- Service plugin specific details -->
  {{#if model.servicePlugin.taskSchedulerName}}
    <table class='detail-list'>
      <thead>
      <tr>
        <th colspan=2>Service Plugin Details</th>
      </tr>
      </thead>
      <tbody>
      <tr>
        <td>Task Scheduler Plugin</td>
        <td>{{txt model.servicePlugin.taskSchedulerName}} [ {{txt model.servicePlugin.taskSchedulerClassName}} ]</td>
      </tr>
      <tr>
        <td>Task Communicator Plugin</td>
        <td>{{txt model.servicePlugin.taskCommunicatorName}} [ {{txt model.servicePlugin.taskCommunicatorClassName}} ]</td>
      </tr>
      <tr>
        <td>Container Launcher Plugin</td>
        <td>{{txt model.servicePlugin.containerLauncherName}} [ {{txt model.servicePlugin.containerLauncherClassName}} ]</td>
      </tr>
      </tbody>
    </table>
  {{/if}}

  {{#if model.description}}
    <div class="panel panel-info">
      <div class="panel-heading">
        Description
      </div>
      <div class="panel-body">
        {{{model.description}}}
      </div>
    </div>
  {{/if}}

  {{#if model.diagnostics}}
    <div class="panel panel-danger">
      <div class="panel-heading">
        Diagnostics
      </div>
      <div class="diagnostics">
        {{{model.diagnostics}}}
      </div>
    </div>
  {{/if}}

{{else}}
  {{partial "loading"}}
{{/if}}
